package org.seeplnframework.skyeye.common.alarmmerge;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author ly
 * @date 2023/1/18
 */
public class AlarmInterfaceUriExceptionLRU<K, V> extends LinkedHashMap<K, V> {

    private int capacity;

    public AlarmInterfaceUriExceptionLRU(int capacity, Map<? extends K, ? extends V> exist) {
        super((int) Math.ceil(capacity / 0.75) + 1, 0.75f, true);
        this.capacity = capacity;
        putAll(exist);
    }

    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
        return size() > capacity;
    }
}
